
                PRESERVE8
                THUMB


; Vector Table Mapped to Address 0 at Reset
                AREA    RESET, DATA, READONLY
				EXPORT  __Vectors
					
__Vectors       DCD     0                  
                DCD     Reset_Handler              ; Reset Handler

				AREA    |.text|, CODE, READONLY

; Reset handler
Reset_Handler   PROC
				EXPORT  Reset_Handler             [WEAK]

				;ENABLE RCC_GPIOC
				LDR R0, =(0x40021000 + 0x18)
				LDR R1,[R0]
				ORR R1,R1,#(1<<4)
				STR R1, [R0]

				;Set OutPut
				LDR R0,=(0x40011000 + 0x04)
				LDR R1,=0xFF0FFFFF
				LDR R2,[R0]
				AND R2,R2,R1
				STR R2,[R0]
				LDR R1,=0x00300000
				LDR R2,[R0]
				ORR R2,R2,R1
				STR R2,[R0]

Loop
				LDR R0, =(0x40011000 + 0x10)
				LDR R1,[R0]
				ORR R1,R1,#(1<<13)
				STR R1,[R0]
				LDR R3,=1000000
				BL delay
				
				LDR R0, =(0x40011000 + 0x14)
				LDR R1,[R0]
				ORR R1,R1,#(1<<13)
				STR R1,[R0]
				LDR R3,=1000000
				BL delay
				
				B Loop 
                ENDP 
                
delay
				SUBS R3,R3,#1
				BNE delay
				MOV PC,LR
                 END
